#include<stdio.h>


/*存在100个数在1到10之间，请找到出现次数最多的数字，并计算出现了几次*/

int main()
{
    int nums[100] = {0};

    /*赋值操作*/
    for (int idx = 0;idx < 100;idx++)
    {
        nums[idx] = rand() % 10 +1;
    }
    for (int idx = 0;idx < 100;idx++)
    {
        printf("nums[%d] = %d\t",idx,nums[idx]);
        if((idx + 1) % 5 == 0)
        {
            printf("\n");
        }
    }
    int times[10] = {0};
    for (int idx = 0;idx < 100;idx++)
    {
        times[nums[idx]-1]++;
    }
    int freMaxNum = times[0];
    int maxValue = 0;
    for (int idx = 0;idx < 10;idx++)
    {
        if(times[idx] > freMaxNum)
        {
            freMaxNum = times[idx];
            maxValue = idx +1;
        }
    }
    printf("freMaxNum:%d,\t maxValue = %d\n",freMaxNum,maxValue);
}